#ifndef BSP_SERVO_H
#define BSP_SERVO_H

#include "header_index.h"

#define  SERVO_YAW_TIM htim2
#define  SERVO_PITCH_TIM htim2
#define  SERVO_ROLL_TIM htim2
#define  SERVO_CATCH_TIM htim2

#define  SERVO_YAW_CHANNEL TIM_CHANNEL_1
#define  SERVO_PITCH_CHANNEL TIM_CHANNEL_2
#define  SERVO_ROLL_CHANNEL TIM_CHANNEL_3
#define  SERVO_CATCH_CHANNEL TIM_CHANNEL_4

typedef struct 
{
    TIM_HandleTypeDef tim;
    unsigned int tim_channel;
    uint8_t angle_set;
    uint8_t angle_output;
    uint16_t ccr;

}Servo_t;


void Servo_Control(void);
void Servo_Init(void);
static void Servo_angle_ccr_calc(Servo_t* servo);
Servo_t* Return_Servo_yaw_point(void);
Servo_t* Return_Servo_pitch_point(void);
Servo_t* Return_Servo_roll_point(void);
Servo_t* Return_Servo_catch_point(void);
#endif
